import axios from 'axios';



(async () => {
    interface Photo {
        alblumId: number;
        id: number;
        title: string;
        url: string;
        thumbnailUrl: string;
    }

    interface Root2 {
        id: number
        name: string
        username: string
        email: string
        address: Address
        phone: string
        website: string
        company: Company
    }

    interface Address {
        street: string
        suite: string
        city: string
        zipcode: string
        geo: Geo
    }

    interface Geo {
        lat: string
        lng: string
    }

    interface Company {
        name: string
        catchPhrase: string
        bs: string
    }

    type Photos = Photo[];
    type PostDatas = Root2[];

    const res = axios.get<Photos>('https://jsonplaceholder.typicode.com/posts').then((res) => {
        console.log(res.data);
    }).catch((err) => {
        console.error('Error fetching data:', err);
    });
    console.log(res);

    const res2 = axios.get<PostDatas>('https://jsonplaceholder.typicode.com/users').then((res) => {
        console.log(res.data);
    }).catch((err) => {
        console.error('Error fetching data:', err);
    });

    console.log(res2);
})();